.class public Ldgb/n4;
.super Ljava/lang/Object;
.source "SourceFile"


# static fields
.field private static volatile h:Ldgb/n4;


# instance fields
.field private a:Landroid/content/Context;

.field private b:Z

.field private c:Landroid/os/Messenger;

.field private d:Ljava/util/concurrent/CopyOnWriteArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/concurrent/CopyOnWriteArrayList<",
            "Ldgb/k;",
            ">;"
        }
    .end annotation
.end field

.field private e:Z

.field private f:Z

.field private g:Landroid/content/ServiceConnection;


# direct methods
.method private constructor <init>(Landroid/content/Context;)V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    new-instance v0, Ldgb/n4$a;

    invoke-direct {v0, p0}, Ldgb/n4$a;-><init>(Ldgb/n4;)V

    iput-object v0, p0, Ldgb/n4;->g:Landroid/content/ServiceConnection;

    .line 3
    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object p1

    iput-object p1, p0, Ldgb/n4;->a:Landroid/content/Context;

    const/4 p1, 0x0

    .line 4
    iput-boolean p1, p0, Ldgb/n4;->b:Z

    const/4 v0, 0x0

    .line 5
    iput-object v0, p0, Ldgb/n4;->c:Landroid/os/Messenger;

    .line 6
    new-instance v0, Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-direct {v0}, Ljava/util/concurrent/CopyOnWriteArrayList;-><init>()V

    iput-object v0, p0, Ldgb/n4;->d:Ljava/util/concurrent/CopyOnWriteArrayList;

    .line 7
    iput-boolean p1, p0, Ldgb/n4;->e:Z

    const/4 p1, 0x1

    .line 8
    iput-boolean p1, p0, Ldgb/n4;->f:Z

    .line 9
    invoke-virtual {p0}, Ldgb/n4;->a()V

    return-void
.end method

.method static synthetic a(Ldgb/n4;Landroid/os/Messenger;)Landroid/os/Messenger;
    .locals 0

    .line 1
    iput-object p1, p0, Ldgb/n4;->c:Landroid/os/Messenger;

    return-object p1
.end method

.method public static a(Landroid/content/Context;)Ldgb/n4;
    .locals 2

    .line 4
    const-class v0, Ldgb/n4;

    monitor-enter v0

    .line 5
    :try_start_0
    sget-object v1, Ldgb/n4;->h:Ldgb/n4;

    if-nez v1, :cond_0

    .line 6
    new-instance v1, Ldgb/n4;

    invoke-direct {v1, p0}, Ldgb/n4;-><init>(Landroid/content/Context;)V

    sput-object v1, Ldgb/n4;->h:Ldgb/n4;

    .line 7
    :cond_0
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 8
    sget-object p0, Ldgb/n4;->h:Ldgb/n4;

    return-object p0

    :catchall_0
    move-exception p0

    .line 9
    :try_start_1
    monitor-exit v0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw p0
.end method

.method private a(Landroid/os/Message;)Z
    .locals 4

    const-string v0, "stat.ServiceInterator"

    const/4 v1, 0x0

    .line 29
    :try_start_0
    iget-object v2, p0, Ldgb/n4;->c:Landroid/os/Messenger;

    invoke-virtual {v2, p1}, Landroid/os/Messenger;->send(Landroid/os/Message;)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    const/4 v1, 0x1

    goto :goto_0

    :catch_0
    move-exception v2

    .line 30
    sget-boolean v3, Ldgb/z;->d:Z

    if-eqz v3, :cond_0

    .line 31
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {p1}, Landroid/os/Message;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string p1, " has Exception!"

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {v0, p1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0

    :catch_1
    move-exception v2

    .line 32
    sget-boolean v3, Ldgb/z;->d:Z

    if-eqz v3, :cond_0

    .line 33
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {p1}, Landroid/os/Message;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string p1, " has RemoteException!"

    invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-static {v0, p1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    :cond_0
    :goto_0
    return v1
.end method

.method static synthetic a(Ldgb/n4;)Z
    .locals 0

    .line 2
    iget-boolean p0, p0, Ldgb/n4;->f:Z

    return p0
.end method

.method static synthetic a(Ldgb/n4;Z)Z
    .locals 0

    .line 3
    iput-boolean p1, p0, Ldgb/n4;->b:Z

    return p1
.end method

.method static synthetic b(Ldgb/n4;)Z
    .locals 0

    .line 1
    iget-boolean p0, p0, Ldgb/n4;->e:Z

    return p0
.end method

.method static synthetic b(Ldgb/n4;Z)Z
    .locals 0

    .line 2
    iput-boolean p1, p0, Ldgb/n4;->e:Z

    return p1
.end method

.method static synthetic c(Ldgb/n4;)Ljava/util/concurrent/CopyOnWriteArrayList;
    .locals 0

    .line 1
    iget-object p0, p0, Ldgb/n4;->d:Ljava/util/concurrent/CopyOnWriteArrayList;

    return-object p0
.end method

.method private c()V
    .locals 4

    .line 2
    iget-object v0, p0, Ldgb/n4;->a:Landroid/content/Context;

    new-instance v1, Landroid/content/Intent;

    iget-object v2, p0, Ldgb/n4;->a:Landroid/content/Context;

    const-class v3, Ldbgc/DService;

    invoke-direct {v1, v2, v3}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    iget-object v2, p0, Ldgb/n4;->g:Landroid/content/ServiceConnection;

    const/4 v3, 0x1

    invoke-virtual {v0, v1, v2, v3}, Landroid/content/Context;->bindService(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z

    return-void
.end method


# virtual methods
.method public a()V
    .locals 2

    .line 10
    sget-boolean v0, Ldgb/z;->c:Z

    if-eqz v0, :cond_0

    const-string v0, "stat.ServiceInterator"

    const-string v1, "Start to bind!"

    .line 11
    invoke-static {v0, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 12
    :cond_0
    iget-boolean v0, p0, Ldgb/n4;->f:Z

    invoke-virtual {p0, v0}, Ldgb/n4;->a(Z)V

    .line 13
    invoke-direct {p0}, Ldgb/n4;->c()V

    return-void
.end method

.method public a(Z)V
    .locals 1

    .line 26
    iput-boolean p1, p0, Ldgb/n4;->f:Z

    .line 27
    iget-boolean v0, p0, Ldgb/n4;->b:Z

    if-eqz v0, :cond_1

    if-eqz p1, :cond_0

    const/4 p1, 0x6

    goto :goto_0

    :cond_0
    const/4 p1, 0x7

    .line 28
    :goto_0
    invoke-virtual {p0, p1}, Ldgb/n4;->a(I)Z

    :cond_1
    return-void
.end method

.method public a(I)Z
    .locals 1

    .line 21
    iget-boolean v0, p0, Ldgb/n4;->b:Z

    if-nez v0, :cond_1

    .line 22
    sget-boolean p1, Ldgb/z;->c:Z

    if-eqz p1, :cond_0

    const-string p1, "stat.ServiceInterator"

    const-string v0, "Service haven\'t bind.The status change trigger will be ignored!"

    .line 23
    invoke-static {p1, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    :cond_0
    const/4 p1, 0x1

    return p1

    :cond_1
    const/4 v0, 0x0

    .line 24
    invoke-static {v0, p1}, Landroid/os/Message;->obtain(Landroid/os/Handler;I)Landroid/os/Message;

    move-result-object p1

    .line 25
    invoke-direct {p0, p1}, Ldgb/n4;->a(Landroid/os/Message;)Z

    move-result p1

    return p1
.end method

.method public a(Ldgb/k;)Z
    .locals 3

    .line 14
    iget-boolean v0, p0, Ldgb/n4;->b:Z

    const/4 v1, 0x1

    if-nez v0, :cond_1

    .line 15
    sget-boolean v0, Ldgb/z;->c:Z

    if-eqz v0, :cond_0

    .line 16
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Service haven\'t bind.The event "

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ldgb/k;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string v2, " will send again when service is bound!"

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v2, "stat.ServiceInterator"

    invoke-static {v2, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 17
    :cond_0
    iget-object v0, p0, Ldgb/n4;->d:Ljava/util/concurrent/CopyOnWriteArrayList;

    invoke-virtual {v0, p1}, Ljava/util/concurrent/CopyOnWriteArrayList;->add(Ljava/lang/Object;)Z

    return v1

    :cond_1
    const/4 v0, 0x0

    .line 18
    invoke-static {v0, v1}, Landroid/os/Message;->obtain(Landroid/os/Handler;I)Landroid/os/Message;

    move-result-object v0

    .line 19
    invoke-virtual {p1}, Ldgb/k;->a()Landroid/os/Bundle;

    move-result-object p1

    invoke-virtual {v0, p1}, Landroid/os/Message;->setData(Landroid/os/Bundle;)V

    .line 20
    invoke-direct {p0, v0}, Ldgb/n4;->a(Landroid/os/Message;)Z

    move-result p1

    return p1
.end method

.method public b()Z
    .locals 2

    .line 3
    iget-boolean v0, p0, Ldgb/n4;->b:Z

    if-nez v0, :cond_1

    .line 4
    sget-boolean v0, Ldgb/z;->c:Z

    if-eqz v0, :cond_0

    const-string v0, "stat.ServiceInterator"

    const-string v1, "Service haven\'t bind.When is bound,it will send again!"

    .line 5
    invoke-static {v0, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    :cond_0
    const/4 v0, 0x1

    .line 6
    iput-boolean v0, p0, Ldgb/n4;->e:Z

    return v0

    :cond_1
    const/4 v0, 0x0

    const/4 v1, 0x2

    .line 7
    invoke-static {v0, v1}, Landroid/os/Message;->obtain(Landroid/os/Handler;I)Landroid/os/Message;

    move-result-object v0

    .line 8
    invoke-direct {p0, v0}, Ldgb/n4;->a(Landroid/os/Message;)Z

    move-result v0

    return v0
.end method
